<%@ page contentType="text/html; charset=iso-8859-1" errorPage="mr_errhandler.jsp" %>
<%@page import="merlin.beans.*,merlin.dao.*,merlin.managers.*,merlin.servlets.*,merlin.utils.*" %>

<jsp:useBean id="autoFill" scope="session" class = "merlin.beans.AutoFillDetails"/>
<jsp:setProperty name="autoFill" property="*" />

<%
	ApplicationResources resource = ApplicationResources.getInstance();

	String separatorString = resource.getProperty("separatorString");
	String separatorPattern = resource.getProperty("separatorPattern");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/MSALtemplate.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<!-- InstanceBeginEditable name="doctitle" -->
		<title>Merlin Scott Associates Limited</title>
		<meta name="description" content="Merlin Scott Associates Limited publish over 700 industry reports comparing company financial performance within an industry. Market research is updated monthly to provide the latest financial analysis available. ">
		<meta name="KEYWORDS" content="financial reports, reports, industry watch, financial review, potential acquisitions, competitors, market trends, company performance, financial performance, financial analysis, industry growth, financial measures, industry rankings">
		<script language="JavaScript">
		    function btnSearchClick()
		    {
		     //need to enusure that if the search form is being displayed, any selected reports are selected
		     //to ensure that they are passed in the request
		     var TheSearchForm = document.frmSearch;
		     if (TheSearchForm == null) {
		       //submit this form
		       document.searchFrm.submit();
		    }
		     else
		     {
		       //submit the search form
		       for (i=0; i < document.all.lstSelectedReports.options.length; i++) {
		         document.all.lstSelectedReports.options(i).selected = true;
		       };
		       document.searchFrm.submit();
		     }
		    }
		</script>

		<script>
			function isBlank(str){
				var len = str.length;
				if(len==0)return true;	// zero-length string
				for(i=0;i<len;i++){
					if(str.charAt(i) !=' ' && str.charAt(i) !='\n')return false; //some character is there
				}
				return true;
			}

			//validate the format of the e-mail address
			function isValidateEMailFormat(aEMailAddress){
				//Check for an email with a .com or .net extension
				var emailcom = /^[a-z][a-z_0-9\.]+@[a-z_0-9\.]+\.[a-z]{3}$/i
				//Check for an email with a .co.uk extension
				var emailcouk = /^[a-z][a-z0-9_\.]+@[a-z0-9_\.]+\.[a-z][a-z]\.[a-z][a-z]$/i
				var TheEMailAddress = new String(aEMailAddress);
				var tmpemail = aEMailAddress;
				var tmpamount = 0;
				var onechars = '';
				//validate the email format
				if ((TheEMailAddress.match(emailcom)) && (TheEMailAddress.match(emailcouk))) {
					return(false);
				};

				//ensure that the e-mail address contains 1 '@'
				for(var p=0; p < tmpemail.length; p++){
					onechars = tmpemail.charAt(p);
					if (onechars == '@')
						tmpamount = tmpamount + 1;
				}//for

				if (tmpamount != 1) {
					return(false);
				}

				return(true);
			}

		 	function searchReports(frm){
				// sanity check
				if(isBlank(frm.txtSearch.value)){
					alert("Enter search text");
					frm.txtSearch.focus();
					return false;
				}

				var reportTitles ="";
				frm.mode.value="searchReportsByReportDesc";
				frm.action = "merlin";
				frm.submit();
				return true;
		 	}

			function submitForRegistration(frm){
				// validate the fields first.
				if(isBlank(frm.txtFirstName.value)){
					alert("Firstname is required");
					frm.txtFirstName.focus();
					return;
				}
				if(isBlank(frm.txtSurname.value)){
					alert("Surname is required");
					frm.txtSurname.focus();
					return;
				}
				if(isBlank(frm.txtCompanyName.value)){
					alert("CompanyName is required");
					frm.txtCompanyName.focus();
					return;
				}
				if(isBlank(frm.txtPostcode.value)){
					alert("Postcode is required");
					frm.txtPostcode.focus();
					return;
				}
				if(isBlank(frm.txtEMailAddress.value)){
					alert("EMail Address is required");
					frm.txtEMailAddress.focus();
					return;
				}
				if(! isValidateEMailFormat(frm.txtEMailAddress.value)){
					alert("EMail Address is not a valid one");
					frm.txtEMailAddress.focus();
					return;
				}

				if(frm.lstReportTitles.selectedIndex == -1){
					alert("Select at least one report");
					frm.lstReportTitles.focus();
					return;
				}

				frm.reportName.value = frm.lstReportTitles.options[frm.lstReportTitles.selectedIndex].text;
				frm.action = "merlin";
				frm.mode.value="saveNewCustomerRegistration";
				frm.submit();
			}
		</script>
		<link href="css/master.css" rel="stylesheet" type="text/css">
		<!-- InstanceEndEditable -->

		<link href="css/master.css" rel="stylesheet" type="text/css">
	</head>

	<body>
		<div id="content">
			<div align="center">
				<table width="750" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="20" colspan="2" class="topnav">
							<ul>
								<li><a href="sitemap.jsp">:: Site Map</a></li>
								<li><a href="contactus.jsp">:: Contact Us</a></li>
							</ul>
						</td>
					</tr>
					<!-- InstanceBeginEditable name="head" -->
					<tr>
						<td height="107" background="new-images/headerMain.gif">&nbsp;</td>
					</tr>
					<!-- InstanceEndEditable -->
					<tr>
						<td height="25" colspan="2">
							<!-- BEGIN #linkList -->
							<div id="linkList">
								<li><span class="bump"><a href="home.jsp">Home</a></span></li>
								<li><a href="samplelayouts/SampleAnalysis.jsp">Our Analysis </a></li>
								<li><a href="contactus.jsp">Contact Us</a></li>
								<li><span class="nudge"><a href="book.jsp">Books</a></span> </li>
								<li><a href="database.jsp">Searchable Databases</a></li>
								<li><a href="enquiries.jsp">700 Industry Reports </a></li>
								<li> <a href="welcomeContent.jsp">Free Updates</a></li>
							</div>
							<!-- END #linkList -->
						</td>
					</tr>
					<!-- InstanceBeginEditable name="content" -->
					<tr>
						<td>
							<table width="750" border="0" cellspacing="0" cellpadding="0">
								<tr>
							        <td width="180">
										<!-- BEGIN #sidenav -->
										<div class="sidenav">
											<div id="LCindustry">
												<h5>Industry Search</h5>
											</div>
											<form action="../MSALNEW/searchContent.jsp" method="POST" name="searchFrm" onsubmit="btnSearchClick()">
												<input type="text" name="edtSearch" class="search"/>
												<a onclick="btnSearchClick()" onmouseover="this.style.cursor='hand'" onmouseout="this.style.cursor='default'"><img src="new-images/search-go.jpg" alt="Search" width="30" height="21" title="Search" /></a>
	       									</form>
										</div>
										<!-- #BeginLibraryItem "/Library/sidenav.lbi" -->
										<div class="sidenav">
											<div id="LCexisting">
												<h5>Existing Customers</h5>
											</div>
											<ul>
												<li>
													<a href="welcomeContent.jsp">Request a FREE Update to Your Report </a><a href="welcomeContent.jsp"></a>
												</li>
											</ul>
											<div id="LCnew">
												<h5>New to the Site?</h5>
											</div>
											<ul>
												<li><a href="searchContent.jsp">Order a Report</a></li>
												<li><a href="searchContent.jsp">Find a Report of Interest</a></li>
												<li><a href="book.jsp">Book Contents</a></li>
												<li><a href="database.jsp">Searchable Database Contents</a></li>
												<li><a href="samplelayouts/SampleAnalysis.jsp">Our Analysis</a></li>
												<li><a href="enquiries.jsp">View a list of all available report titles</a></li>
											</ul>
										</div><!-- #EndLibraryItem --><!-- END #sidenav -->
									</td>
									<td width="20"><img src="spacer.gif" width="20" height="1">
									</td>
									<td width="550">
										<!-- BEGIN #rightColumn -->
										<div class="content-main">
											<div class="rightColumn">
												<div id="orangeBar">
													<h5 class="welcome">Register</h5>
												</div>
												<strong>Please provide all the details below to allow us to set up your account. We will contact you by Email when this is complete.</strong>

	  											<div>
													<form name="frmRegistrationDetails" action="" method="POST">
														<input type="hidden" name="mode" value="saveNewCustomerRegistration">
														<input type="hidden" name="pageName" value="mr_customerRegistration.jsp">
														<input type="hidden" name="reportName" >
														<table class="adjust">
															<tr>
																<td style="width: 120px;"><span style="color: #b0740c;">*</span> First Name</td>
																<td><input type="text" name="txtFirstName" value='<jsp:getProperty name="autoFill" property="txtFirstName"/>'></td>
															</tr>
															<tr>
																<td><span style="color: #b0740c;">*</span> Surname</td>
																<td><input type="text" name="txtSurname" value='<jsp:getProperty name="autoFill" property="txtSurname"/>'></td>
															</tr>
															<tr>
																<td><span style="color: #b0740c;">*</span> Company</td>
																<td><input type="text" name="txtCompanyName" value='<jsp:getProperty name="autoFill" property="txtCompanyName"/>'></td>
															</tr>
															<tr>
																<td><span style="color: #b0740c;">*</span> Postcode</td>
																<td><input type="text" name="txtPostcode" value='<jsp:getProperty name="autoFill" property="txtPostcode"/>'></td>
															</tr>
															<tr>
																<td><span style="color: #b0740c;">*</span> Email Address</td>
																<td><input type="text" name="txtEMailAddress" value='<jsp:getProperty name="autoFill" property="txtEMailAddress"/>'></td>
															</tr>
														</table>
														<br /><br />
														<table>
															<tr>
																<td colspan="2"><strong>To find reports of interest search by keyword in the title or description.</strong></td>
															</tr>
															<tr>
																<td style="width: 120px;">Keyword</td>
																<td><input type="text" name="txtSearch" style="text-transform: uppercase"> <input name="btnSearch" type="button" class="input" value="Search For Report" style="font-size: 11px; width: 130px;" onclick="searchReports(this.form)"></td>
															</tr>
															<tr>
																<td colspan="2" style="padding: 8px 0px 0px 0px;">The following Reports were found by this search. <em>(Click on the report you want to register with)</em>.</td>
															</tr>
															<tr>
																<td></td>
																<td>
																	<SELECT name="lstReportTitles" size="5" style="width: 300px">
															  		<%
															     		DbResultSet dbRes = (DbResultSet)request.getAttribute("reportDetails");
															     		if(dbRes != null){
															     			for(int i=0;i<dbRes.size();i++){
															     				ReportTitlesBean bean = (ReportTitlesBean)dbRes.get(i);
																				out.println("<option value=\"" + bean.getReportTitlesId() + "\">" + bean.getReportTitle() + "</option>");
															     			}
																   		}
																	%>
																	</SELECT>
																</td>
															</tr>
															<tr>
																<td></td>
																<td style="padding: 10px 0px 0px 0px;">
																	<input name="btnRegister" type="button" class="input" style="font-size: 11px; width: 130px;" value="Register Details" onclick="submitForRegistration(this.form)">
																</td>
															</tr>
														</table>
													</form>
												</div>
											</div>
										</div>
										<!-- END #rightColumn -->
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<!-- InstanceEndEditable -->
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="750">
								<tr>
									<td width="375"><!-- BEGIN #Footer -->
										<div id="footer">
											<a href="http://www.merlinscottassociates.co.uk">Copyright&copy; 2005 Merlin Scott Associates Limited<br>All Rights Reserved<br></a>
											<a href="http://www.calicatdesign.com" target="_blank">Site Designed by CaliCat Design &amp; Web Consulting</a>
										</div>
									</td>
									<td width="375">
										<div id="footerRight">
											<a href="home.jsp">Home</a> | <a href="about.jsp">About</a> | <a href="contactus.jsp">Contact Us</a> | <a href="products.jsp">Products</a>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			<div>
		</div>
	</div>
</div>

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=928985;
var sc_invisible=1;
var sc_partition=7;
var sc_security="206963a7";
</script>

<!--script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/frames.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img  src="http://c8.statcounter.com/counter.php?sc_project=928985&amp;amp;java=0&amp;amp;security=206963a7&amp;amp;invisible=1" alt="hidden hit counter" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
</body>

<!-- InstanceEnd --></html>